package com.kfm.base.date;

public class Exer02 {

    public static void main(String[] args) {
        /*
        编写一个程序，去除字符串中的重复字符
         */
        String str = "abcdacbdq";
        String s = unRepeat(str);
        System.out.println(s);
    }


    public static String unRepeat(String str){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {

            String sub = str.substring(i, i + 1);

            if (sb.indexOf(sub) == -1){
                sb.append(sub);
            }
        }
        return sb.toString();
    }
}

